package com.a.basis;

public class Test2DArray {
    public static void main(String[] args) {
        int[][] nums=new int[3][5];

        nums[0][0]=10;
        nums[0][1]=20;
        nums[0][2]=30;
        nums[0][3]=40;
        nums[0][4]=50;

        nums[1][0]=100;
        nums[1][1]=200;
        nums[1][2]=300;
        nums[1][3]=400;
        nums[1][4]=500;

        nums[2][0]=1000;
        nums[2][1]=2000;
        nums[2][2]=3000;
        nums[2][3]=4000;
        nums[2][4]=5000;
        for (int i = 0; i < nums.length; i++) { //高维下标
            for (int j = 0; j < nums[i].length; j++) {  //低维下标
                System.out.print(nums[i][j]+"\t");
            }
            System.out.println();
        }

        //创建数组

        int[][] nums1=new int[][]{{1,2,3},{4,5,6}};
        int[][] nums2=new int[4][];
        System.out.println(nums2[0]);       //高维有空间没有值为null
        //给低维数组地址
        nums2[0]=new int[3];
        nums2[1]=new int[4];
        nums2[2]=new int[5];
    }
}
